package com.forkjoin;

/**
 * @author mayixiang
 * @date 2021-02-18 13:18
 */
public class StateMachine implements MyState {

    public MyState startState;
    public MyState evaluateState;
    public MyState checkAndRptState;
    public MyState endState;

    private MyState state;

    public StateMachine(){
        startState = new StartState(this);
        evaluateState = new EvaluateState(this);
        checkAndRptState = new CheckAndRptState(this);
        endState = new EndState(this);
        state = startState;
    }

     public void start() {
        state.start();
    }

    public void setState(MyState state) {
        this.state = state;
    }

    public void evaluate() {
        state.evaluate();
    }

     public void checkAndRpt() {
        state.checkAndRpt();
    }

     public void end() {
        state.end();
    }
}
